import { formatDate } from '@/utils/common'
import { useModal } from '@/views/report/reporting/useModal'
import { Column } from '@/components/dynamic-table/types'

export const columns: Column[] = [
  {
    title: '序号',
    dataIndex: 'serial'
  },
  {
    title: '报表编号',
    dataIndex: 'reportNumber'
  },
  {
    title: '报表名称',
    dataIndex: 'reportName'
  },
  {
    title: '报表模板',
    dataIndex: 'reportTemplate',
    slots: {
      customRender: 'reportTemplate'
    }
  },
  {
    title: '报表频度',
    dataIndex: 'reportFrequency'
  },
  {
    title: '状态',
    dataIndex: 'status',
    slots: {
      customRender: 'status'
    }
  },
  {
    title: '报送时间',
    dataIndex: 'reportTime',
    slots: {
      customRender: 'reportTime'
    },
    slotsType: 'format',
    slotsFunc: (val) => formatDate(val)
  },
  {
    title: '填报部门',
    dataIndex: 'creator'
  },
  {
    title: '操作',
    dataIndex: 'action',
    slots: {
      customRender: 'action'
    },
    actions: [
      {
        type: 'text',
        text: '查看/报送',
        style: {
          color: '#FF5500'
        },
        func: ({ record }) => {
          console.log(record)
          useModal('查看报表', record)
        }
      }
    ]
  }
]
